home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
kermit.columbia.edu
/
kermit.columbia.edu.tar
/
kermit.columbia.edu
/
newsgroups
/
misc.20020314-20021006
/
000257_hairyveggie@yahoo.com_Fri Aug 2 10:11:18 EDT 2002.msg
< prev
next >
Wrap
Text File
|
2002-10-06
|
4KB
|
89 lines
Article: 13573 of comp.protocols.kermit.misc
Path: newsmaster.cc.columbia.edu!panix!bloom-beacon.mit.edu!newsfeed.stanford.edu!postnews1.google.com!not-for-mail
From: hairyveggie@yahoo.com (Luke Weese)
Newsgroups: comp.protocols.kermit.misc
Subject: Renaming a file after receiving
Date: 1 Aug 2002 16:51:48 -0700
Organization: http://groups.google.com/
Lines: 71
Message-ID: <d49c50d5.0208011551.2aeed298@posting.google.com>
NNTP-Posting-Host: 12.148.134.9
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1028245909 14956 127.0.0.1 (1 Aug 2002 23:51:49 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: 1 Aug 2002 23:51:49 GMT
Xref: newsmaster.cc.columbia.edu comp.protocols.kermit.misc:13573
Hi. So we all know, I am a newbie to C-Kermit scripting. I have
written some scripts to dial in to a Wildcat BBS system, choose some
menu options, and receive a file using the Zmodem protocol (they
support Kermit protocol, but they highly recommend Zmodem because they
obviously havent read the Performance chapter in the Kermit manual,
judging by the 3.8% efficiency of the download). All of this goes
through fine, but the only problem I had is that when using Zmodem,
the "as-name" argument to the receive command is apparently ignored.
I worked around this with some rather silly scripting involving
redirecting an "ls" command, parsing the filename and renaming, but I
was hoping someone could suggest a less clumsy way to rename the
downloaded file. Here's the excerpt of my script:
-------------START----------------
mkdir tmpdir ; Make "tmpdir" to
store this download
if fail goto mkdirfailed ; Bail if permissions
messed up
cd tmpdir ; Move into "tmpdir"
set take error on ; Set the error
detection
set terminal autodownload off ; Turn auto download
off
; Use Zmodem protocol
set protocol zmodem rz {rz -a} {sz %s} {sz -a %s} rz {rz -a}
-------------DIALING, etc...------
receive hndyinvc.dat ; Download the file
If fail goto downloadfailure ; Error receiving file
.\%x := \Ffiles(*) ; Count the files in
tmpdir
If = 1 \%x ls > ../dir.txt ; If only 1, list to
parent dir
else goto oldfilesoutthere ; More than one file,
bail
cd .. ; Go back to
"hndmodem"
open read dir.txt ; Open list file
if fail goto nodirfile ; Bail if nonexistent
read \%o ; Read first line,
"total n"
if fail goto nodirfile ; Bail if nonexistent
read \%o ; Read 2nd line with
filename
if fail goto nodirfile ; Bail if nonexistent
.\%d := \Fsubstring(\%o,57) ; Get filename from
pos 57 on
cd tmpdir ; Go back to "tmpdir"
If exist \%d mv \%d ../hndyinvc.dat ; If there, move back
and rename
cd .. ; Go back to
"hndmodem"
rmdir tmpdir ; Remove "tmpdir" for
next time
If fail echo Could not remove "tmpdir" automatically. Please remove
manually.
rm dir.txt ; Remove "dir.txt"
If fail echo Could not remove "dir.txt" automatically. Please remove
manually.
------------FINISH----------------
Please excuse any newbie mistakes in the coding, but feel free to
point them out. Thanks in advance for any help.